<template>
	<view class="dati-body__group">
		<globalCard>
			<view class="q__item">
				{{nowQ.qtitle}}
			</view>

			<view class="a__group">

				<template v-for="(item,index) in arr">

					<template v-if="nowQ[`ans${item}`]">


						<view @click="aItemClickHandler(index)" :class="['a__item',{active:checked===index}]" :key="index">

							<view class="check_item"></view>&nbsp;{{item|miva}}.&nbsp;{{nowQ[`ans${item}`]}}

						</view>

					</template>

				</template>

			</view>
			<!-- <view class="biaozhu-btn__item">
				我要标注
			</view> -->
		</globalCard>

	</view>
</template>

<script>
	export default {
		filters: {
			miva(str) {
				const arr = [, 'A', 'B', 'C', 'D']
				return arr[str];
			}
		},
		props: {
			nowQ: {
				type: Object,
				required: true
			}
		},
		data() {
			return {
				arr:[1, 2, 3, 4],
				checked: -1
			}
		},
		methods: {
			aItemClickHandler(num) {
				this.checked = num;
				this.$emit('change', num + 1);
			}
		}
	}
</script>

<style lang="scss">
	.dati-body__group {
		padding: 20px;

		.q__item {
			font-weight: bold;
			margin-bottom: 20px;
		}

		.a__item {
			margin-bottom: 10px;
			padding: 5px 30px;
			border-radius: 4px;
			background-color: #F1F1F1;
			display: flex;
			align-items: center;
		}

		.active {
			background-color: #C2C2C2;

			.check_item {
				border-color: #C2C2C2;
			}

			.check_item::before {
				content: '✔';
				position: relative;
				top: -5px;
				left: 1px;
				color: $miva-color-base;
			}
		}

		.check_item {
			width: 15px;
			height: 15px;
			border: 1px solid #666;
			border-radius: 50%;
			margin-right: 10px;
			flex-shrink: 0;
		}

		.biaozhu-btn__item {
			font-size: 12px;
			text-align: center;
			border-top: 1px dotted;
			padding-top: 10px;
			color: #666;
		}
	}
</style>
